<?php
/**
 * Created by PhpStorm.
 * User: nhson219
 * Date: 9/24/14
 * Time: 2:16 PM
 */

?>
<table class="table table-striped">
    <tr>
        <td>STT</td>
        <td><?php echo $this->lang->line('title')?></td>
        <td><?php echo $this->lang->line('description')?></td>
        <td><?php echo $this->lang->line('Download')?></td>
        <td><?php echo $this->lang->line('Options')?></td>
    </tr>
    <?php
        if( (isset($listDownloadFile) == TRUE ) && ($listDownloadFile->num_rows() > 0))
        { $stt = 0;
        foreach($listDownloadFile->result() as $item){ $stt++;
    ?>
    <tr>
        <td><?php echo $stt;?></td>
        <td><?php echo $item->title; ?></td>
        <td><?php echo $item->description; ?></td>
        <td><a href="<?php echo site_url('project/DownloadFile/'.$item->id)?>"><span class="glyphicon glyphicon-download-alt"></span></a> </td>
        <td><a style="cursor: pointer" data-id="<?php echo $item->id; ?>" class="delete-file"><?php echo $this->lang->line('Delete')?></a> </td>
    </tr>
        <?php
            }
        }
    ?>
</table>
<script>
    $('.delete-file').click(function(){
        var file_id = $(this).attr('data-id');
        $.post( "<?php echo site_url('project/deleteFile')?>", { file_id: file_id } )
            .done(function( data ) {
                $("#list-download-file").load('<?php echo base_url()."index.php/project/listDownloadFile"?>',{'project_id': <?php echo $project_id;?>})
            });
    });
</script>